<template>
<div id="blocksDetailed">
        <div class="search_box">
            <div class="container">
                <p>{{ $lang("TRANSACTION2") }}</p>
            </div>
        </div>
        <div class="tran_table">
            <div class="container">
                <div class="bread_rumb clearfix">
                    <div class="f_l">
                        <el-breadcrumb separator-class="el-icon-arrow-right">
                        <el-breadcrumb-item :to="{ path: '/' }">{{ $lang('HOME') }}</el-breadcrumb-item>
                        <el-breadcrumb-item :to="{ path: '/Transaction' }">{{ $lang('TRANSACTION') }}</el-breadcrumb-item>
                        <el-breadcrumb-item>{{ $lang('TRANSACTION2') }}</el-breadcrumb-item> 
                        </el-breadcrumb>
                    </div>
                </div>
                <div class="ul">
                    <div class="ulname">{{ $lang('Stream_hash') }}</div>
                    <div class="ulmsg">{{transactionList.hash}}</div>
                </div>
                <div class="ul">
                    <div class="ulname">{{ $lang('Transaction_time') }}</div>
                    <div class="ulmsg">{{dateFormat(transactionList.time)}}</div>
                </div>
                <div class="ul">
                    <div class="ulname">{{ $lang('Block_height') }}</div>
                    <div class="ulmsg">{{transactionList.blockheight }}</div>
                </div>
                <!-- <div class="ul">
                    <div class="ulname">{{ $lang('Trading_status') }}</div>
                    <div class="ulmsg">{{transactionList.status }}</div>
                </div> -->
                <div class="ul">
                    <div class="ulname">{{ $lang('Token') }}</div>
                    <div class="ulmsg">{{transactionList.token || 'EQU'}}</div>
                </div>
                <div class="ul">
                    <div class="ulname">{{ $lang('Payment_address') }}</div>
                    <div class="ulmsg"><router-link style="cursor: pointer;color: #cca33c;" :to="{path:'/account/sender/' + transactionList.payaddress }">{{ transactionList.payaddress }}</router-link></div>
                </div>
                <div class="ul">
                    <div class="ulname">{{ $lang('Receiving_address') }}</div>
                    <div class="ulmsg"><router-link style="cursor: pointer;color: #cca33c;" :to="{path:'/account/receiver/' + transactionList.receiptaddress }">{{ transactionList.receiptaddress }}</router-link></div>
                </div>
                <div class="ul">
                    <div class="ulname">{{ $lang('Transaction_amount') }}</div>
                    <div class="ulmsg">{{transactionList.value }}</div>
                </div>
                <div class="ul">
                    <div class="ulname">{{ $lang('Egg_price') }}</div>
                    <div class="ulmsg">{{transactionList.eggprice }}</div>
                </div>
                <div class="ul">
                    <div class="ulname">{{ $lang('Maximum_eggs') }}</div>
                    <div class="ulmsg">{{transactionList.eggmax }}</div>
                </div>
                <div class="ul">
                    <div class="ulname">{{ $lang('Actual_consumption') }}</div>
                    <div class="ulmsg">{{transactionList.eggused }}</div>
                </div>
                <div class="ul">
                    <div class="ulname">{{ $lang('Additional_data') }}</div>
                    <div class="ulmsg">{{transactionList.extardata }}</div>
                </div>
                <div class="ul">
                    <div class="ulname">{{ $lang('Transaction_type') }}</div>
                    <div class="ulmsg">{{transactionList.tradetype }}</div>
                </div>
                <!-- <div class="ul" v-for="item in transactionList">
                    <div class="ulname">{{ $lang('Record_number') }}</div>
                    <div class="ulmsg">{{item.count }}</div>
                </div> -->
            </div>
        </div>
    </div>
</template>

<script>
import axios from 'axios';
import { gets,formatTime } from '@/api/api.js';
import url from '@/api/url.js';
export default {
	data(){
		return {
			input:"",
			currentPage:1, // 分页当前页
			pageSize:5, // 每页条数
            transactionList: {},
		}
	},
	mounted(){
        this.getTransactionsDetail()
	},
	methods:{
        getTransactionsDetail(type){
            let that = this
            const loading = this.$loading({
                text: that.$lang('loading'),
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
            });
            axios.get(url.urlblockH + '/transaction/getTransactionsDetail', {
                params: {
                    hash: this.$route.params.id,
                }
            })
            .then(function (res) {
                loading.close()
                that.transactionList = res.data.data
            })
            .catch(function (error) {
                loading.close()
                console.log(error);
            })
        },
        // 格式日期
        dateFormat(val) {
            if (val === undefined) {
                return false
            } else {
                let time = JSON.parse(val)
                return formatTime(new Date(time), 'yyyy-MM-dd hh:mm:ss')
            }
        }
	}
	
}
</script>
<style lang="scss" >
@import '~assets/scss/blocksDetailed.scss';
.el-breadcrumb__inner{
    color: #fff !important;
}
</style>